#include "scnedit.h"
#include "scn/scn.h"

struct vertProp_t
{
    u32 vertidxidx;
    u32 surf_vertidx;
    bool bShared;
    core::array<u32> sharesWith;
};

class CSelector
{
    private:
        enum E_PAINT_TYPE {RED, BLUE, CLEAR};


        CScn*               scn;
        scene::SMesh*       scnMesh;
        core::array<u32>              redSurfs;
        core::array<u32>             blueSurfs;




        void clearRedSurfs();
        void clearBlueSurfs();
        video::ITexture * redtex;
        video::ITexture * bluetex;
        video::ITexture * nulltex;

        core::array<u32>  calcSharedSurfaces(u32);
        core::array<u32>  calcSharedSurfaces(core::array<u32>&);

        void paint(u32, E_PAINT_TYPE); void paint(core::array<u32>, E_PAINT_TYPE);
        void makeSurfRed(u32); void makeSurfRed(core::array<u32>);
        void makeSurfBlue(u32); void makeSurfBlue(core::array<u32>);
        void remRedSurf(u32);
        void remBlueSurf(u32);

    public:

        CSelector(CScn *, scene::SMesh *, IrrlichtDevice*);
        ~CSelector();

        core::array<u32>& getRedSurfs() {return redSurfs;}

        core::array<u32>& getBlueSurfs() {return blueSurfs;}

        void selectSurf(s32 i, bool bAppend);

        core::array<vertProp_t> getSurfVertProps(u32 si);


        //boxes
        core::array<core::aabbox3df> boxes;

};
